/**
 * 
 */
package de.wemwolf.server;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

/**
 * Class to startup the server.
 * 
 * @author Sheepy, Andre
 *
 */
public class ServerStartup {

	/**
	 * Startup method for the sever
	 * 
	 * @param args no args required
	 */
	public static void main(String[] args) {
		
		try {
		    ServerRMIImpl obj = new ServerRMIImpl();
		    IServerRMI stub = (IServerRMI) UnicastRemoteObject.exportObject(obj, 0);

		    // Bind the remote object's stub in the registry
		    Registry registry = LocateRegistry.getRegistry("localhost");
		    registry.bind("server", stub);

		    System.err.println("Server ready");
		} catch (Exception e) {
		    System.err.println("Server exception: " + e.toString());
		    e.printStackTrace();
		}

	}

}
